package com.bupt.user.controller;


import com.bupt.annotation.LoginRequired;
import com.bupt.user.client.UserClient;
import com.bupt.user.entity.User;
import com.bupt.user.mapper.UserMapper;
import com.bupt.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sdclone
 * @since 2021-03-24
 */
@RestController
public class UserController implements UserClient {

    @Autowired
    private UserService userService;

    @Override
    public User login(User user) {
        return userService.login(user);
    }

    @Override
    @LoginRequired
    public User getUserByUserId(String userId) {
        return userService.getUserByUserId(userId);
    }

    @Override
    public void logout() {
        userService.logout();
    }

    @Override
    public User getUserFromSession() {
        return userService.getUserFromSession();
    }
}
